package com.gmgx.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping("student")
public class StudentController {
    @RequestMapping("login")
    public String login(){
        System.out.println("login方法");
        // 字符串只需要写 jsp文件名，不用写后缀，后缀由视图解析器帮你拼接
        return "main";
    }

    @RequestMapping("queryStudentBySno")
    public ModelAndView queryStudentBySno(Integer sno){
        System.out.println("queryStudentBySno:sno="+sno);

        ModelAndView mv = new ModelAndView();
        // 相当于request.setAttribute();
        mv.addObject("sname", "wwy");
        /*jsp 文件名（不用后缀）*/
        mv.setViewName("queryStudentBySno");
        return mv;
    }
}
